/*
 ============================================================================
 Page	     : 556-557
 Name        : assert.c
 Date	     : 20210408
 Author      : Hbue 18060333
 Copyright   : Your copyright notice
 Description : 使用assert()
 ============================================================================
 */

#include <stdio.h>
#include <math.h>
#include <assert.h>

int main(void)
{
	double x = 0;
	double y = 0;
	double z = 0;

	puts("Enter a pair of numbers (0 0 to quit):");
	while(scanf("%lf%lf", &x, &y) == 2 && (x != 0 || y != 0))
	{
		z = x * x - y * y;		/* 应该用 + */
		assert(z >= 0);
		printf("answer is %f\n", sqrt(z));
		puts("Next pair of numbers: ");
	}
	puts("Done");

	return 0;
}

